<?php
namespace app\know\controller;

use app\know\model\ChapterModel;
use app\know\model\MaterialModel;
use app\know\controller\AdminKnowBaseController;
use app\know\validate\ChapterValidate;

/**
 * Class AdminTeachingMaterialChapterController 教材章节控制器
 * @package app\know\controller
 */
class AdminTeachingMaterialChapterController extends AdminKnowBaseController
{
    /**
     * 教材章节
     * @adminMenu(
     *     'name'   => '教材章节',
     *     'parent' => 'know/AdminTeachingMaterial/index',
     *     'display'=> true,
     *     'hasView'=> true,
     *     'order'  => 31200,
     *     'icon'   => '',
     *     'remark' => '教材章节',
     *     'param'  => ''
     * )
     */
    public function index()
    {
        $content = hook_one('know_admin_teaching_material_chapter_index_view');

        if (!empty($content))
		{
            return $content;
        }
        $w = ['is_delete' => 0, 'material_type' => 'teach'];
		$materials = MaterialModel::where($w)->order('order_number', 'desc')->select();

		$this->assign('materials', $materials);	
        return $this->fetch();
    }

}
